﻿using System.Configuration;

namespace TTprotons.Crm.ExternalView.Service.Settings
{
    /// <summary>
    /// Strongly typed class for configuration settings in web.config file.
    /// </summary>
    public class Config
    {
        #region Default values

        private const int QUERYRECORDLIMIT_DEFAULT = 2500;

        #endregion

        public static string CrmOnlineUserId
        {
            get { return ConfigurationManager.AppSettings["CrmOnlineUserId"]; }
        }

        public static string CrmOnlinePassword
        {
            get { return ConfigurationManager.AppSettings["CrmOnlinePassword"]; }
        }

        public static string CrmOnlineOrganization
        {
            get { return ConfigurationManager.AppSettings["CrmOnlineOrganization"]; }
        }

        public static int CrmQueryRecordLimit
        {
            get
            {
                var strRecordLimit = ConfigurationManager.AppSettings["CrmQueryRecordLimit"];
                int recordLimit;
                return int.TryParse(strRecordLimit, out recordLimit) ? recordLimit : QUERYRECORDLIMIT_DEFAULT;
            }
        }
    }
}